import { createRouter, createWebHistory} from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('@/views/Home.vue')
  },
  {
    path: '/detail',
    name: 'Detail',
    redirect: '/detail/view',
    component: () => import('@/views/DetailLayout.vue'),
    children: [
      {
        path: 'manage',
        name: 'ArticleManage',
        component: () => import('@/views/article/Manage.vue')
      },
      {
        path: 'category',
        name: 'ArticleCategory',
        component: () => import('@/views/article/Category.vue')
      },
      {
        path: 'statistics/article',
        name: 'ArticleStatistics',
        component: () => import('@/views/statistics/ArticleStatistics.vue')
      },
      {
        path: 'statistics/problem',
        name: 'ProblemStatistics',
        component: () => import('@/views/statistics/SolutionStatistics.vue')
      },
      {
        path: 'profile',
        name: 'UserProfile',
        component: () => import('@/views/user/Profile.vue')
      },
      {
        path: 'view',
        name: 'ArticleView',
        component: () => import('@/views/article/ArticleView.vue')
      },
      {
        path: 'problem',
        name: 'ProblemView',
        component: () => import('@/views/problem/ProblemView.vue')
      },
      {
        path: 'solution',
        name: 'SolutionView',
        component: () => import('@/views/problem/SolutionView.vue')
      },
      {
        path: 'change-password',
        name: 'ChangePassword',
        component: () => import('@/views/user/ChangePassword.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/user/Login.vue')
  }
]


// 创建路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})


// 导出路由
export default router